from rest_framework import serializers

from apps.goods.models import GoodsVisitCount


class CategorySerializer(serializers.ModelSerializer):

    # 关联序列化返回 子表返回父表
    category = serializers.StringRelatedField()

    class Meta:
        model = GoodsVisitCount
        # 指定要序列化的字段
        fields = ["category","count"]